const orderTypeEnum = {
	WAIT: {
		code: 1,
		msg: '待接单'
	},
	GET: {
		code: 2,
		msg: '已接单'
	},
	WAITING: {
		code: 3,
		msg: '等待中'
	},
	START: {
		code: 4,
		msg: '服务中'
	},
	PENDING_PAY: {
		code: 5,
		msg: '待支付'
	},
	FINISH: {
		code: 6,
		msg: '已完成'
	},
	REFUND_PENDING: {
		code: 7,
		msg: '待退款'
	},
	REFUNDED: {
		code: 8,
		msg: '已退款'
	},
	REFUND_REFUSED: {
		code: 9,
		msg: '拒绝退款'
	},
	CANCEL: {
		code: 10,
		msg: '已取消'
	}
}

function getTypeNameByCode (code) {
	let res = null
	const typesKeys = Object.keys(orderTypeEnum)
	typesKeys.forEach(k => {
		if (orderTypeEnum[k].code === code) {
			res = orderTypeEnum[k].msg
		}
	})
	return res ? res : '未知的订单类型'
}

export {
	orderTypeEnum,
	getTypeNameByCode
}